package Events;

import javax.swing.JTextArea;

import structures.Spaceship;
import structures.Tradepost;
import Events.gui.TradepostGUI;


/**
 * PlanetEvent is when you cross a planet on your path.
 * @author edd
 *
 */
@SuppressWarnings("serial")
public class PlanetEvent extends PathEvent{

	PlanetType type;
	
	/**
	 * Basic constructor.
	 * @param name	name of Planet
	 * @param description	description of Planet
	 * @param type	PlanetType enumerated type for the planet
	 * @param location	location of the planet
	 */
	public PlanetEvent(String name, String description, PlanetType type, int location) {
		super(name, description, location);
		this.type = type;
	}

	
	@Override
	public boolean isRunning() {
		// TODO Auto-generated method stub
		return running;
	}

	@Override
	public void nextPhase() {
		// TODO Auto-generated method stub
		running = false;
	}

	@Override
	public void prevPhase() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void execute(Spaceship s) {
		// TODO Auto-generated method stub
		Tradepost tp = type.createTradepost(this, s);
		tp.addCustomer(s);
		tp.setEvent(this);
		TradepostGUI tpg = new TradepostGUI(tp);
		this.add(tpg);
		running = true;
	}
	
	public void execute(Spaceship s, JTextArea log) {
	    this.execute(s);
	}

	
	
}
